package com.longge;

import java.time.*;
import java.util.Calendar;
import java.util.Date;

public class SumOfMultiples {

    public int sumOfMultiples(int n) {

        int sum = 0;
        for (int i = 1; i <= n; i++) {
           if (i%3==0){
               sum+=i;
           }else if (i%5==0){
               sum+=i;
           }else if (i%7==0){
               sum+=i;
           }
        }
        return sum;
    }

    public static void main(String[] args) {
        Date currentDate = new Date();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(currentDate);
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        Date previousDayZeroTime = calendar.getTime();
        System.out.println("前一天零点时间：" + previousDayZeroTime);

    }
}
